package org.testis.gui.mvc.model.testdesign;

import org.testis.gui.mvc.model.*;
import org.testis.gui.mvc.controller.testdesign.DbConfigController;


/**
 *
 * @author nurhat
 */
public class DbConfigModel extends AbstractModel
{

    private String m_dataBaseUrl = "";
    private String m_userName = "";
    private String m_password = "";
    private String m_catalogName = "";
    private String m_activeMqUrl = "";
    private Boolean m_dbConfigVisibility = false;


    public DbConfigModel()
    {
    }


    public DbConfigModel(String dataBaseUrl,
                         String userName,
                         String password,
                         String catalogName)
    {
        setDataBaseUrl(dataBaseUrl);
        setUserName(userName);
        setPassword(password);
        setCatalogName(catalogName);
    }


    public String getDataBaseUrl()
    {
        return m_dataBaseUrl;
    }


    public void setDataBaseUrl(String dataBaseUrl)
    {
        if (dataBaseUrl == null) {
            dataBaseUrl = "";
        }
        String oldValue = m_dataBaseUrl;
        m_dataBaseUrl = dataBaseUrl;
        firePropertyChange(DbConfigController.CHANGE_DATABASE_URL,
                           oldValue,
                           m_dataBaseUrl);
    }


    public String getUserName()
    {
        return m_userName;
    }


    public void setUserName(String userName)
    {
        if (userName == null) {
            userName = "";
        }
        String oldValue = m_userName;
        m_userName = userName;
        firePropertyChange(DbConfigController.CHANGE_USERNAME,
                           oldValue,
                           m_userName);


    }


    public String getPassword()
    {
        return m_password;
    }


    public void setPassword(String password)
    {
        if (password == null) {
            password = "";
        }
        String oldValue = m_password;
        m_password = password;
        firePropertyChange(DbConfigController.CHANGE_PASSWORD,
                           oldValue,
                           m_password);
    }


    public Boolean getDbConfigVisibility()
    {
        return m_dbConfigVisibility;
    }


    public void setDbConfigVisibility(Boolean dbConfigVisibility)
    {
        boolean oldValue = m_dbConfigVisibility;
        m_dbConfigVisibility = dbConfigVisibility;
        firePropertyChange(DbConfigController.SHOW_DBCONFIG_VIEW,
                           oldValue,
                           m_dbConfigVisibility);


    }


    public String getCatalogName()
    {
        return m_catalogName;
    }


    public void setCatalogName(String catalogName)
    {
        String oldValue = m_catalogName;
        m_catalogName = catalogName;
        firePropertyChange(DbConfigController.CHANGE_CATALOG_NAME,
                           oldValue,
                           m_catalogName);

    }


    public String getActiveMqUrl()
    {
        return m_activeMqUrl;
    }


    public void setActiveMqUrl(String activeMqUrl)
    {

        String oldValue = m_activeMqUrl;
        m_activeMqUrl = activeMqUrl;
        firePropertyChange(DbConfigController.CHANGE_ACTIVEMQ_URL,
                           oldValue,
                           m_activeMqUrl);

    }
}
